package com.siao.example.libaray.component.controller
{
	import com.siao.applications.ApplicationManager;
	import com.siao.example.libaray.Libaray;
	import com.siao.example.libaray.component.method.ComponentMethod;
	import com.siao.example.libaray.component.state.ComponentComboBoxState;
	import com.siao.example.libaray.component.state.ComponentListState;
	import com.siao.example.libaray.component.state.ComponentScrollListState;
	import com.siao.example.libaray.component.state.ComponentScrollPanelState;
	import com.siao.example.libaray.component.state.ComponentScrollbarState;
	import com.siao.example.libaray.component.state.ComponentStackState;
	import com.siao.mvc.Controller;
	import com.siao.mvc.notice.Notice;
	
	/**
	 * 组件控制器
	 * @author SiaoLeon
	 */
	public class ComponentController extends Controller
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function ComponentController()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			this.register(ComponentMethod.ENTER_COMPONENT_SCROLLBAR, ENTER_SCROLLBAR_EXAMPLE);
			this.register(ComponentMethod.ENTER_COMPONENT_LIST, ENTER_LIST_EXAMPLE);
			this.register(ComponentMethod.ENTER_COMPONENT_STACK, ENTER_STACK_EXAMPLE);
			this.register(ComponentMethod.ENTER_COMPONENT_SCROLLPANEL, ENTER_SCROLLPANEL_EXAMPLE);
			this.register(ComponentMethod.ENTER_COMPONENT_SCROLLLIST, ENTER_SCROLLLIST_EXAMPLE);
			this.register(ComponentMethod.ENTER_COMPONENT_COMBOBOX, ENTER_COMBOBOX_EXAMPLE);
		}
		
		// -------------------------------------------------------------------------------------------------------- 函数
		
		private function ENTER_SCROLLBAR_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentScrollbarState);
		}
		
		private function ENTER_LIST_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentListState);
		}
		
		private function ENTER_STACK_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentStackState);
		}
		
		private function ENTER_SCROLLPANEL_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentScrollPanelState);
		}
		
		private function ENTER_SCROLLLIST_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentScrollListState);
		}
		
		private function ENTER_COMBOBOX_EXAMPLE(notice:Notice):void
		{
			(ApplicationManager.instance.currentApplication as Libaray).main.switchState(ComponentComboBoxState);
		}
	
	}
}
